
let res = wx.getMenuButtonBoundingClientRect()
			let _this = this
			// 获取店铺状态
			this.getShopInfo()
			this.selectHeight = res.height
			if (this.token() === "") {
				uni.showModal({
					title: "温馨提示",
					content: "亲，授权微信登录后才能点餐！",
					showCancel: false,
					success(res) {
						if (res.confirm) {
							let jsCode = ""
							uni.login({
								provider: "weixin",
								success: (loginRes) => {
									//console.log('login的loginRes', loginRes);
									if (loginRes.errMsg === "login:ok") {
										jsCode = loginRes.code
									}
								},
							})
							// 授权
							uni.getUserProfile({
								desc: "登录",
								success: function (userInfo) {
									_this.setBaseUserInfo(userInfo.userInfo)
									const params = {
										code: jsCode,
										// 传递地理位置信息
									}
									// console.log('登录的的userInfo', userInfo);
									// 获取定位信息
									uni.getLocation({
										type: 'gcj02', isHighAccuracy: true
									}).then(([err, result]) => {
										if (err) {
											uni.showToast({
												title: "获取地理位置失败",
												icon: "none"
											})
										} else {
											if (process.env.NODE_ENV === '"development"') {
												params.location = `116.481488,39.990464`//	先写死在北京
											} else {
												params.location = `${result.longitude},${result.latitude}`
											}
											// console.log('传给后端的login params', params);
											userLogin(params)
												.then((success) => {
													 // console.log('success.data.token', success.data.token);
													_this.setToken(success.data.token)
													_this.init()
													getMarketInfo().then( (marketInfoRes) =>{
														_this.setDeliveryFee(marketInfoRes.data.deliveryFee)
														_this.setShopInfo({
															shopName: marketInfoRes.data.shopName,
															shopAddress: marketInfoRes.data.shopAddress,
															shopId: marketInfoRes.data.shopId,
														})
													} )
													// if (success.code === 1) {
													// 	_this.setToken(success.data.token)
													// 	// 保存配送费
													// 	_this.setDeliveryFee(success.data.deliveryFee)
													// 	// 保存商铺信息
													// 	_this.setShopInfo({
													// 		shopName: success.data.shopName,
													// 		shopAddress: success.data.shopAddress,
													// 		shopId: success.data.shopId,
													// 	})
													// 	_this.init()
													// }
												})
												.catch((err) => { })



										}

									})

								},
								fail: function (err) { },
							})
						}
					},
				})
			}